<?php

namespace Sifast\ProjectBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;

class CertificationsAdmin extends Admin
{
 
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
        ->with('L1')
            ->add('natureCertification','text',array(
                'label'=> 'Nature certification:',))
            ->add('dateObtention', 'date', array(
                    'label'=> "Date d'obtention :",
                    'widget' => 'single_text',
                    'format' => 'MM/dd/yyyy',
                    'attr' => array('class' => 'datepicker')
                ))
        ->end()  
        ->with('L2')        
            ->add('dateExpiration', 'date', array(
                    'label'=> "Date d'expiration :",
                    'widget' => 'single_text',
                    'format' => 'MM/dd/yyyy',
                    'attr' => array('class' => 'datepicker')
                ))
         ->end()   ;
            
    }

    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('natureCertification')
            ->add('dateObtentation')
            ->add('dateExpiration')
            ;
            
    }

    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('natureCertification')
            ->add('dateObtentation')
            ->add('dateExpiration')
            ;
            
            }
}